//package org.example.ldap;
//
//import org.springframework.ldap.core.LdapTemplate;
//import org.springframework.ldap.core.support.DirContextSource;
//
//public class LdapTemplateDemo {
//    public static void main(String[] args) {
//        DirContextSource contextSource = new DirContextSource();
//        contextSource.setUrl("ldap://corp.abc.com");
//        contextSource.setUserDn("admin");
//        contextSource.setPassword("password");
//        contextSource.setReferral("follow");
//        LdapTemplate ldapTemplate = new LdapTemplate(contextSource);
//        String base = "OU=hangzhou";
//        boolean authenticated = ldapTemplate.authenticate(base, "(sAAccountName=userName)", "userPwd");
//        System.out.println(authenticated);
//    }
//}
